#include <logging.h>
#include <time.h>

/*
* This function is to be called once, 
* before the first call to log_write is made.
*  
* log_file_name is the path and file name of the file to be used for logging.
*/
void log_setUp(char* log_file_name){

	FILE *log;
	
	log = fopen("%s", log_file_name);
}

/*
* Writes a log entry to the log file.
* entries must be formatted with this pattern: "%s: %s: %s: %s: %s\n"
* From left to right the %s are to be:
*  - a time stamp, in local time.
*  - module (which part of the program created the entry?)
*  - p1
*  - p2
*  - p3
* 
* Note: This function may be called from multiple threads and hence must
*       ensure that only one thread is writing to the file at any given time.
*/
void log_write(char* module, char* p1, char* p2, char* p3){

	/* variables for timestamp */
	time_t 	now;
	struct 	tm *ts;
	char 	buffer[80];
	
	/* determine current time and format: ddd mm dd hh:mm:ss yyyy */
	now = time(0);
	strftime(buffer, sizeof(buffer), "%a %m %d %H:%M:%S %Y", ts);
	
	/* determine module */
	
	/* determine user */
	
	/* determine command */
	
	/* determine additional arguments */
	
	/* print the line of the log file when all arguments complete */
	printf("%s: %s: %s: %s: %s\n", buffer, , , , );
}

